import java.util.ArrayList;
import java.util.List;

public class problem27 {
    public static void main(String[] args) {
        double longest = 0;
        double number = 0;
        for (double a = -999; a < 1000; a++) {
            for (double b = -999; b < 1000; b++) {
                double floorA = Math.abs(a);
                double floorB = Math.abs(b);
                double n = 0;

                double result = 0;
                while (true) {
                    result = Math.pow(n, 2) + (floorA * n) + floorB;
                    if (!ProjectEuler.isPrime(result))
                        break;
                    n++;
                }

                if ((n - 1) > longest) {
                    System.out.println(a + " " + b + " " + n);
                    number = a * b;
                    longest = n;
                }
            }
        }

        System.out.println(number + " " + longest);
    }
}
